// include不仅用于包含像stdio.h这样的库文件，也可用于包含
// 自己写的头文件，不同之处在于，库文件使用'<>'，自己写的
// 头文件一般使用'""'，这是由于包含路径的不同，可暂时这样
// 记忆，到第九章的时候你会明白的更多。

#include "exam.h"
#include "utility.h"

void arithmetic()
{
    int ans_int = 5;
    const char ans_str[64] = "+,-,*,/,%";
    printf("第五章习题\n5.1 C语言支持多少种算术运算符(arithmetic operators)？\n");
    check_int(ans_int);
    printf("这 %d 种算术运算符分别为（以,分隔）？\n", ans_int);
    check_str(ans_str);
}

void relational()
{
    int ans_int = 6;
    const char ans_str[64] = "<,<=,>,>=,==,!=";
    printf("第五章习题\n5.1 C语言支持多少种关系运算符(relational operators)？\n");
    check_int(ans_int);
    printf("这 %d 种关系运算符分别为（以,分隔）？\n", ans_int);
    check_str(ans_str);

}

void logical()
{
    int ans_int = 3;
    const char ans_str[64] = "&&,||,!";
    printf("第五章习题\n5.1 C语言支持多少种逻辑运算符(logical operators)？\n");
    check_int(ans_int);
    printf("这 %d 种逻辑运算符分别为（以,分隔）？\n", ans_int);
    check_str(ans_str);

}

void true_false()
{
    int a = 3, b = 4, c = 5;
    int x, y;
    int ans_int = a + b > c && b == c;
    printf("第五章习题\n5.2 int a = 3, b = 4, c = 5; 写出下式的计算结果？\na + b > c && b == c\n");
    check_int(ans_int);
    ans_int = a || b + c && b - c;
    printf("第五章习题\n5.2 int a = 3, b = 4, c = 5; 写出下式的计算结果？\na || b + c && b - c\n");
    check_int(ans_int);
    ans_int = !(a > b) && !c || 1;
    printf("第五章习题\n5.2 int a = 3, b = 4, c = 5; 写出下式的计算结果？\n!(a > b) && !c || 1\n");
    check_int(ans_int);
    ans_int = !(x = a) && (y = b) && 0;
    printf("第五章习题\n5.2 int a = 3, b = 4, c = 5; 写出下式的计算结果？\n!(x = a) && (y = b) && 0\n");
    check_int(ans_int);
    ans_int = !(a + b) + c - 1 && b + c / 2;
    printf("第五章习题\n5.2 int a = 3, b = 4, c = 5; 写出下式的计算结果？\n!(a + b) + c - 1 && b + c / 2\n");
    check_int(ans_int);
}
